/**
 * 
 */
package com.feib.stms.dao.jdbc.rowmapper;

import java.sql.ResultSet;

import org.springframework.jdbc.core.RowMapper;

import com.feib.stms.model.Group;
import com.feib.stms.model.User;
import com.feib.stms.model.UserLoginControl;

/**
 * @author Jimmy Liu
 *
 */
public class UserLoginControlRowMapper extends BaseRowMapper<UserLoginControl> implements RowMapper<UserLoginControl> 
{
	
	private static final long serialVersionUID = 5197387123795792691L;

	public UserLoginControlRowMapper() {
		super(UserLoginControl.class);
	}
	
	@Override
	protected UserLoginControl doOtherMapRow(ResultSet rs, int rowNumber, UserLoginControl entity) {

		User user = new User();
		entity.setUser(user);
		user.setUserPk((Long)getColumnValue(rs, "USER_PK", Long.class));
		

		user.setUserId((String)getColumnValue(rs, "USER_ID", String.class));
		
		user.setGroup(new Group());
		user.getGroup().setGroupNo((String)getColumnValue(rs, "GROUP_NO", String.class));
		user.getGroup().setGroupPk((Long)getColumnValue(rs, "GROUP_PK", Long.class));
		
		
		entity.setLoginLocaleIP((String)getColumnValue(rs, "LOGIN_LOCALE_IP", String.class));
		entity.setActived(getColumnBoolean(rs, "IS_ACTIVED"));
		
		return entity;
	}


}
